package com.cy.pj.sys.web.controller;

import com.cy.pj.common.pojo.JsonResult;
import com.cy.pj.sys.pojo.SysDept;
import com.cy.pj.sys.service.SysDeptService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


@RestController
@RequestMapping("/dept/")
@Api(tags = "部门")
public class SysDeptController {
	@Autowired
	private SysDeptService sysDeptService;
	@PostMapping("find")
	@ApiOperation(value = "查找部门关系信息")
	public JsonResult doFindObjects() {
		return new JsonResult(sysDeptService.findMenus());
	}
	@PostMapping("treeNodes")
	@ApiOperation(value = "查找部门信息")
	public JsonResult doFindZTreeNodes() {
		return new JsonResult(sysDeptService.findDeptTreeNodes());
	}

	@PostMapping("updateMenu")
	@ApiOperation(value = "更新部门信息")
	public JsonResult doUpdateMenu(@RequestBody SysDept entity){
		sysDeptService.updateMenu(entity);
	    return new JsonResult("update ok");
	}

	@PostMapping("save")
	@ApiOperation(value = "保存部门信息")
	public JsonResult doSaveMenu(@RequestBody SysDept entity){
		sysDeptService.saveMenu(entity);
		return new JsonResult("save ok");
	}
}
